home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Computer Life 1996 January
/
Computer Life January 1996.iso
/
telix
/
tfw.5
/
WCONFIG.SLT
< prev
next >
Wrap
Text File
|
1995-07-28
|
7KB
|
248 lines
//////////////////////////////////////////////////////////////////////////////
//
// W C O N F I G . S L T
//
// Copyright (C) 1988,1989,1990,1991 Exis Inc.
// Copyright (C) 1994 deltaComm Development, Inc.
//
// - Written by Colin Sampaleanu.
// - Modifications by Jeff Woods, Feb '91, to add help function and support
// for locked modems.
// - Modifications for Telix for Windows July '94
// - Modifications to user interface Dec '94 by Sean Palmer
// - More modifications to user interface Mar '95 by Jeff Smith
//
// This is a Host Mode configuration script for Telix for Windows.
// It reads from and saves parameters to the file WINHOST.CNF.
//
//////////////////////////////////////////////////////////////////////////////
str host_downloads[64],
host_uploads[64],
host_message[64],
our_dir[64];
int modem_lock = 0,
direct_connect = 0,
closed_sys = 0,
temp_var;
#INCLUDE "WHUTILS.SLT"
//////////////////////////////////////////////////////////////////////////////
main() {
get_our_dir();
read_host_config_file();
host_configure();
}
//////////////////////////////////////////////////////////////////////////////
host_configure() {
str s[200];
int c, f, i, stat;
int lnum, inp, old_lnum;
str hold_line[75];
lnum=old_lnum=10;
if (!host_downloads) {
if (getenv ("HOST2DIR", s) != 0) {
host_downloads = our_dir;
strcat (host_downloads, "XFER\");
}
else {
host_downloads = _telix_dir;
strcat(host_downloads, "HOSTDOWN\");
}
}
if (!host_uploads) {
if (getenv ("HOST2DIR", s) != 0) {
host_uploads = our_dir;
strcat (host_uploads, "XFER\");
}
else {
host_uploads = _telix_dir;
strcat(host_uploads, "HOSTDOWN\");
}
}
if (!host_message) {
if (getenv ("HOST2DIR", s) != 0) {
host_uploads = our_dir;
}
else {
host_message = _telix_dir;
strcat(host_message, "HOSTMSG\");
}
}
while (1) {
clear_scr ();
prints("^M^JWCONFIG - WinHost Mode Configuration Script^M^J");
printsc(" Host download directory: ");
prints(host_downloads);
printsc(" Host upload directory : ");
prints(host_uploads);
printsc(" Host message directory : ");
prints(host_message);
printsc(" Connection type : ");
if (direct_connect)
prints("Direct");
else
prints("Modem");
printsc(" Lock Speed (0=none) : ");
printn(modem_lock); newline();
printsc(" Sign-up mode : ");
if (closed_sys) {
prints ("Closed (users may not sign up on-line)");
}
else {
prints ("Open (users may sign up on-line)");
}
prints("^M^J Exit without saving changes.");
prints(" Exit and save changes to disk.^M^J");
vgetchrs(2, lnum, hold_line, 0, 75);
vputchrs(2, lnum, hold_line, 0, 75, 16*_fore_color+_back_color);
vputchrs(2, lnum, "->", 0, 2, 16*_fore_color+_back_color);
do
{
if (subchr(hold_line, 3) != ' ')
inp=inkeyw();
if ((inp == 18432) or (inp == 19200)) lnum=lnum-1;
if ((inp == 20480) or (inp == 19712)) lnum=lnum+1;
if (lnum < 3) lnum = 3;
if (lnum > 11) lnum = 11;
vputchrs(2, old_lnum, hold_line, 0, 75, _fore_color+_back_color*16);
vgetchrs(2, lnum, hold_line, 0, 75);
vputchrs(2, lnum, hold_line, 0, 75, 16*_fore_color+_back_color);
vputchrs(2, lnum, "->", 0, 2, 16*_fore_color+_back_color);
old_lnum=lnum;
}
while ((inp != 13) and (inp != 32));
c = lnum;
if (c < 3 || c > 11)
continue;
if (c >= 3 && c <= 6)
printsc("Enter new value (Esc to abort): ");
if (c == 3) {
s = host_downloads;
stat = inputbox ("Host Download Directory", "Directory:", s);
if (stat == 1) {
host_downloads = s;
strupper(host_downloads);
}
if ((i = strlen(host_downloads)) != 0) // add slash if needed
if (subchr(host_downloads, i - 1) != '\')
copystr("\", host_downloads, i, 1);
}
else if (c == 4) {
s = host_uploads;
stat = inputbox ("Host Upload Directory", "Directory:", s);
if (stat == 1) {
host_uploads = s;
strupper(host_uploads);
}
if ((i = strlen(host_uploads)) != 0)
if (subchr(host_uploads, i - 1) != '\')
copystr("\", host_uploads, i, 1);
}
else if (c == 5) {
s = host_message;
stat = inputbox ("Host Message Directory", "Directory:", s);
if (stat == 1) {
host_message = s;
strupper(host_message);
}
if ((i = strlen(host_message)) != 0)
if (subchr(host_message, i - 1) != '\')
copystr("\", host_message, i, 1);
}
else if (c == 6) {
direct_connect = ! direct_connect;
}
else if (c == 7) {
itos(modem_lock, s);
inputbox ("Modem Lock Speed", "", s);
modem_lock = stoi(s);
}
else if (c == 8) {
closed_sys = ! closed_sys;
}
else if (c == 10) {
prints("^M^JWCONFIG done.^M^J");
return;
}
else if (c == 11) {
if (! check_directory (host_downloads)) {
s = host_downloads;
strcat (s, " does not exist^M^JHost will not run until its directories exist!");
msgbox ("Warning", s, 0);
}
if ((strcmpi (host_downloads, host_uploads) != 0) && (! check_directory (host_uploads))) {
s = host_uploads;
strcat (s, " does not exist^M^JHost will not run until its directories exist!");
msgbox ("Warning", s, 0);
}
if (! check_directory (host_message)) {
s = host_message;
strcat (s, " does not exist^M^JHost will not run until its directories exist!");
msgbox ("Warning", s, 0);
}
s = our_dir;
strcat(s, "WINHOST.CNF");
f = fopen(s, "w");
if (!f) {
printsc("Error writing to ");
printsc(s);
prints("!");
continue;
}
fputs(host_downloads, f);
fputs("^M^J", f);
fputs(host_uploads, f);
fputs("^M^J", f);
fputs(host_message, f);
fputs("^M^J", f);
if (direct_connect)
fputs("Direct^M^J", f);
else
fputs("Modem^M^J", f);
itos(modem_lock, s);
fputs(s, f);
fputs("^M^J", f);
if (closed_sys)
fputs ("Closed", f);
else
fputs ("Open", f);
prints("^M^JWCONFIG done.^M^J");
fclose(f);
return;
}
}
}